package com.lt.Demo;

/**
 * @author LT
 * @version 1.0
 * @PackageName com.lt.Demo
 * @ClassName Singleton
 * @Description to do
 * @date 2021/11/8 16:22
 */
public class Singleton {
    private volatile static Singleton instance = null;
    private Singleton(){

    }
    public static Singleton getInstance(){
        if(instance == null){
            synchronized (Singleton.class){
                if (instance == null){
                    instance = new Singleton();
                }
            }
        }
        return instance;
    }
    public void show(){
        System.out.println("单例模式");
    }

    public static void main(String[] args) {

    }
}
